<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    //Uncaught SyntaxError: A class may only have one constructor
    class User {
        /*constructor() {
            console.log("我是一个空参构造方法");
        }*/
        constructor(name, age) {
            console.log("name:", name)
            console.log("age:", age)
        }

        //多个函数之间不需要加逗号
        //javascript方法没有重载
        read() {
            console.log("我在读书")
        }

        read(book) {
            console.log("我在读书" + book)
            console.log(arguments.length)
            console.log(arguments[0],arguments[1])
        }
    }

    let user1 = new User();
    let user2 = new User("李白", 123);
    user1.read("三国","水浒传");
    //user2.read();
</script>
</body>
</html>
